﻿// JSON C# Class Generator
// http://at-my-window.blogspot.com/?page=json-class-generator

using System;
using Newtonsoft.Json.Linq;
using JsonCSharpClassGenerator;
using TomatoSynchronizer.Store;

namespace TomatoSynchronizer.Entities
{
	public class Devise
	{
		public override bool Equals(object obj)
		{
			if(obj is Devise)
			{
				Devise devise = (Devise)obj;
				if(devise._code == _code && devise._decimal_places == _decimal_places && devise._symbol_left == _symbol_left && devise.symbol_right == symbol_right && devise._title == _title && devise._value == _value && devise.is_default == _is_default)
				{
					return true;
				}
			}
			
			return false;
		}
		
		public Devise()
		{
		}
		
		public Devise(string json)
			: this(JObject.Parse(json))
		{
		}

		private JObject __jobject;
		public Devise(JObject obj)
		{
			this.__jobject = obj;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		private DeviseStore store;
		public DeviseStore Store
		{
			get{
				return store;}
			set{
				store = value;}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _id;
		public string id
		{
			get
			{
				if(string.IsNullOrEmpty(_id) && __jobject != null)
					_id = JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "id")).ToString();
				return _id;
			}
			set
			{
				_id = value;
			}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _title;
		public string title
		{
			get
			{
				if(string.IsNullOrEmpty(_title))
					_title = JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "title"));
				return _title;
			}
			set
			{
				_title = value;
			}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _symbol_left;
		public string symbol_left
		{
			get
			{
				if(string.IsNullOrEmpty(_symbol_left) && __jobject != null)
				{
					_symbol_left = JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "symbol_left"));
					if(string.IsNullOrEmpty(_symbol_left))
					{
						_symbol_left = string.Empty;
					}
				}
				return _symbol_left;
			}
			set
			{
				_symbol_left = value;
			}
		}
		

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _symbol_right ;
		public string symbol_right
		{
			get
			{
				if(string.IsNullOrEmpty(_symbol_right) && __jobject != null)
				{
					_symbol_right = JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "symbol_right"));
					if(string.IsNullOrEmpty(_symbol_right))
					{
						_symbol_right = string.Empty;
					}
				}
				return _symbol_right;
			}
			set
			{
				_symbol_right = value;
			}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private int _decimal_places;
		public int decimal_places
		{
			get
			{
				if(_decimal_places == null)
					_decimal_places = JsonClassHelper.ReadInteger(JsonClassHelper.GetJToken<JValue>(__jobject, "decimal_places"));
				return _decimal_places;
			}
			set
			{
				_decimal_places = value;
			}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _value;
		public string value
		{
			get
			{
				if(string.IsNullOrEmpty(_value))
					_value = JsonClassHelper.ReadLong(JsonClassHelper.GetJToken<JValue>(__jobject, "value")).ToString();
				return _value;
			}
			set
			{
				_value = value;
			}
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _code;
		public string code
		{
			get
			{
				if(string.IsNullOrEmpty(_code))
					_code = JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "code"));
				return _code;
			}
			set
			{
				_code = value;
			}
		}
		
		public Devise(string title,string symbol_left,string symbol_right,int decimal_places,string value,string code,string is_default)
		{
			_title = title;
			_symbol_left = symbol_left;
			_symbol_right = symbol_right;
			_decimal_places = decimal_places;
			_value = value;
			_code = code;
			_is_default = is_default;
		}

		[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
		private string _is_default;
		public string is_default
		{
			get
			{
				if(string.IsNullOrEmpty(_is_default) && __jobject != null)
					_is_default = JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "is_default"));
				return _is_default;
			}
			set
			{
				_is_default = value;
			}
		}

	}
}
